  There are NO warranties of ANY kind for the original PUFF version 2.0 or
for my changes in version 2.3. Use this programme entirely at YOUR OWN risk!

  PUFF 2.3 should run on most modern PCs that use a VGA type screen. It does
not need the TSR, TSRFONT.COM, at all. PUFF 2.3 is for VGA only, so will not
run on PCs with an EGA, or CGA monitor. It's a DOS graphics mode programme
but will run perfectly well in windoze.

  PUFF has an artwork function that isn't all that useful nowadays, as it
only prints via the LPT1 port or makes an .HPG file for a plotter. I've never
really used this part of PUFF, but it does work on my inkjet printer.
  The artwork function only draws transmission lines, so pads for lumped
parts such as chip resistors have to be added manually. There are public
domain PCB layout programmes that may be more useful. I've used line
dimensions from PUFF, in Protel Autotrax, to layout circuit boards.

  An undocumented programme feature is that brackets may be used in the
F3 parts list to exclude data, e.g. (12pF).

  PUFF calculates all transmission lines, of any length, as having 0 dB loss
at F=0Hz. I very much doubt the loss figure where skin depth exceeds one
half of the metal thickness. Skin depth in copper at 1 MHz is 0.0662 mm
and is proportional to the square root of wavelength. The loss figure seems
reasonable where skin depth << metal thickness. The problem is twofold,
firstly in the loss calculation at fd and secondly in scaling the loss when
making a frequency plot; not easily fixed.

Summary of the main changes/fixes in PUFF 2.3

1   Runtime error on fast PCs due to CRT unit fixed; CRT is no longer used.
    The functions of CRT that PUFF uses have been implemented with assembler
    code.

2   Garbage text characters on modern PCs fixed.

3   Blinking cursor not working properly in windoze fixed. Cursor flash rate
    is now independent of CPU speed, and the cursor doesn't stop when the
    left/right arrow key is held down.

4   Changed the permanent message box into a pop up message box. This
    allows the programme to use the normal VGA graphics mode that has 30
    text lines per screen with an 8x16 character set.

5   Unified the code for drawing borders around all the windows and simplified
    the method of writing titles in the F1-F4 windows.

6   Fixed a problem when a lumped component was given a length; the width on
    the screen was set to that of a tline of Zo=Zd instead of the 1/20
    "Manhattan" width.

7   Fixed the logic for resetting the F3 Parts window after using F10 help.
    If the F3 window was set to the large format of 18 parts, the F4 Board
    window was redrawn after using F10 help for the F1 or F2 windows, instead
    of restoring the large parts list.

8   Fixed quite a few problems with PUFF error messages where messages were
    not displayed or wrong messages were given or, the wrong variable was
    being checked. In some cases, PUFF crashed before the trigger point for
    an error message was reached.
      Some new error messages have been added to stop PUFF crashing; e.g.
    metal thickness > 0.75 times substrate height for Striplines, or a bad
    \b{oard number in a .PUF file, or where error messages were missing;
    e.g. for length of qlines and clines.
      Clines were checked for a negative length in PUFF 2.0, but not if
    longer than board size or less that circuit resolution.

9   Error message problems have been fixed, in part, by the addition of a
    custom exit procedure that displays some messages. It also gives error
    addresses and codes, when and if PUFF 2.3 crashes, plus other information.

10  Directory list function for PUFF files added. Date or name sort, short
    or long form display; select a file to be loaded with the arrow keys.
    A file spec can be entered to select which files are shown (it's *.PUF
    at start up). A file can be deleted by pressing "D" then "Y" to confirm.
      Being a DOS programme, the file is really deleted instead of the pretend
    delete in windoze. Depending on the operating system and the file system
    on the HDD, it may be possible to recover a deleted file with an UNDELETE
    programme.

11  Online "Help" and information added, press F9 from any window.

12  Calculation of initial transmission line dimensions now includes PCB
    metal thickness (mt). With the new code, except for striplines with
    mt>0.39 board height, the difference between the F3 Parts list Zo and
    the "Advanced model" Zo (with ! in the line) is almost zero; in PUFF 2.0
    it could be >25% for Microstrip clines.
      For Striplines with mt>0.39 board height, a different formula is used
    to produce more accurate dimensions; PUFF reports a lower Zo in this case.
    The dimensions agree quite well with graphs in one reference book that
    I have.

13  Zo limits have been added that reduce crashes in PUFF 2.3. Limits vary
    according to the board size, dielectric constant, height and mt; and
    circuit resolution. Zo limits for Manhattan transmission line parts don't
    include board size and have a fixed circuit resolution of 10 micrometres.
    Clines can now have Zodd/Zeven=0.99 (limit was 0.97).
      A lower limit for mt of 1.0 micrometre is set in the programme and a
    minimum circuit resolution of 25 micrometres is also set, to minimise
    crashes.
    Maximum Microstrip line width is 100 times board height, and Stripline
    maximum width is 25 times board height. Cline Zo range is set mainly by
    the edge-to-edge spacing which NOW can't be less than the circuit
    resolution.

14  For Microstrip tlines, dispersion is tested when you check the line in
    the F3 window with the = key, with a ! in the parts line. If calculated
    Zo at fd=0Hz, is <99% of the Zo in the F3 Parts list, then a "dispersion"
    message appears in the message box.

15  PUFF crashed if ? (?ohms) or a value of <4.5 ohms, with an Er of 4.8,
    was entered for one impedance of a Stripline cline...fixed this.

16  Minimum dielectric constant Er, changed from >0 to >1. PUFF crashed when
    plotting a Microstrip cline! with Er<=1.

17  Added metal thickness to the display when the = key is pressed in the
    F3 window for tlines or qlines.

18  Transformers may now be specified with a zed ratio by adding a Z after
    the number instead of :1.

19  Check for an existing file added to the Ctrl+S save file function in the
    F2 window, a backup file is made before overwriting an existing file.

20  Changed the filename input function so that it excludes illegal DOS
    filename characters. Now you can use the Esc key to exit from this
    function without entering a name. A path\filename must conform to the
    DOS 8+3 format and may be up to 64 characters long. The name will wrap
    around in the message box if it's longer than 21 characters.

21  A "Set Path" function to your .PUF files and .DEV files has been added.
    Press Ctrl+P in the F3 window, or P in F8 directory list to enter the
    path. The path is stored in SETUP.PUF along with the background colour
    when you save SETUP.PUF. If the path in SETUP.PUF is a blank, or invalid,
    PUFF 2.3 will look for all files in the directory of PUFF23.EXE

22  PUFF 2.3 can be started from any directory without needing SETUP in that
    directory. If PUFF 2.3 is started with ANY filename on the command line,
    PUFF 2.3 will look for the file and device files in the current directory,
    unless the filename contains a path. With a path, PUFF 2.3 looks for all
    files in the path.

23  8 background colours can be selected with the F5/F6 keys instead of two.
    The colour setting is saved into the SETUP.PUF file, see above.

24  Format of .PUF save files changed slightly so that S parameter data is in
    nice columns and scientific notation numbers have four significant digits.

25  Changed minimum plot points from one to three because PUFF crashed when
    trying to load a file with one point.

26  In the F2 Plot window, number of decimal places for frequency now changes
    according to the value, to maintain an eight character length. Also
    changed the dB range for S parameters in the plot window to +/- 200 dB.
    Outside of this range the display is <-200 dB or >200 dB.

27  Added a return loss to impedance converter. In the F2 Plot window, press
    the = key when the cursor is on S11, S22, S33 or S44. The equivalent
    series resistance, reactance, and VSWR are shown in the message box.
    If you move the marker with the Page Up/Page Down keys, the R and X
    display will change according to frequency. Repeated presses of the
    equals key toggles the conversion between series R and X (Rs,Xs) and
    parallel R and X (Rp,Xp). N.B. The circuit MUST be plotted on entry to
    the F2 Plot window before this function will work.

28  Added a number formatting routine that changes the number of decimal
    places and the unit prefix to maintain a fixed number length.
    This was initially done for the S parameter converter. This routine is
    now used for most numbers in the message box and for numbers in the F2
    Plot window.
    N.B. If a transmission line dimension is <0.1 mm then it's now given
    in micrometres.

29  Added a fast plot function (press F or Ctrl+F). I found that there were
    multiple screen writes to the F2 Plot window for each plot point. For a
    circuit plot of two S parameters, there were over 1000 screen writes for
    100 plot points! In PUFF, the screen writes go via the BIOS and are rather
    slow. Screen writes are reduced by >98% if you press 'F' to plot. Plot
    times can be reduced by a factor of up to 10 depending on the PC and the
    circuit in the Layout Window.

30  Maths co-processor emulation disabled and code specific to EGA and CGA
    monitors removed.

31  Sign for micro, ACSII #230, in F3 window can now be made with ALT+U as
    well as ALT+M.

32  Simplified the code for displaying the .PUF filename below the layout
    window. The original code didn't work too well. If you entered a name
    of 12 characters or more without an extension, while DOS truncated the
    name to 8 characters, PUFF displayed all 12 characters as the filename.

33  Changed the Real number types to types better suited to the maths
    co-processor. This gave a reduction in plot time and more free memory.

34  If a .PUF file has been changed or a putative change made, and no errors
    are detected in the F2,F3 or F4 windows, then you will be prompted
    to save the file before exiting or loading a new file.

35  Added code so that a device file may have an OPTIONAL frequency unit in
    the template line after "f" or "F", e.g. fGHz. Valid units are kHz, MHz,
    GHz and THz. The template line looks something like this:-
     f          s11           s21           s12          s22
    When a device file is read in, the frequency prefix in PUFF 2.3 is changed
    to that of the device file. The change doesn't affect your existing device
    files, PUFF 2.3 reads them exactly as before. The frequency in .PUF files,
    when used as device files, is also checked and fd changed if necessary.

36  In conjunction with the above, added a function to read the low and high
    frequencies plus optional unit (see above) in a device file. In the F3
    Parts window, press the = key when the cursor is on a device part.

37  Found that PUFF crashed when trying to plot a circuit of >105 parts and
    often, when free memory was low, would freeze with a "Memory exhausted"
    message. Fixed the memory checking, added extra checks, and added code
    to set a limit of 100 parts in a circuit. The number of keystrokes to
    draw a circuit affects the plotting ability of PUFF. Erased parts add to
    the memory required to plot a circuit and slow down the plotting.
    Files that contain many component erasures may cause PUFF to run out of
    memory when plotted. In this case you should erase the circuit with
    Ctrl+E, and redraw the circuit.

38  More error problems! Found that the code for reporting errors in the 17
    board parameters of a .PUF file didn't work properly. Also there was no
    code to detect a faulty number format for these parameters. Unknown board
    parameter units were detected but if fd or zd were set to zero then PUFF
    crashed without any error message and also crashed my PC! If a .PUF file
    was made faulty then there was an "Improper file" error, but there was no
    error message for a bogus file.
    There is also the annoying feature in PUFF 2.0, that only six of the
    board numbers can be edited from the keyboard.

    To fix these problems I've installed a totally new system for reading in,
    displaying, editing and saving the board parameters. PUFF 2.3 does this:-
a)  Detects unknown parameters and missing lines. If a number in a .PUF file
    is faulty or out of limits then a default is used; the error message tells
    you the faulty number(s).
b)  Reports faulty or bogus files. If PUFF 2.3 has started OK, the previous
    file is re-loaded.
c)  Writes numbers to the F4 window much the same as they appear in the .PUF
    file, so 1296 MHz isn't shown as 1.3E+0003 MHz when a .PUF file is loaded.
    (You can use/edit scientific notation numbers if you wish.)
d)  Allows all parameters from design impedance (zd) to mitre fraction (m)
    to be edited from the keyboard. (Use the up/down arrow keys to scroll the
    parameter list; F10 help explains the parameter prefix letters.)
e)  Detects faulty or out of limit numbers as they are entered in the F4
    window; the cursor indicates the bad number if possible.
f)  Saves numbers to a .PUF file in the same format as they appear in the
    F4 window.

    PUFF 2.3 has the same number length limits as PUFF 2.0 does; 8 characters
    for numbers with a unit, and 12 characters without a unit. Numbers longer
    than this in a .PUF file are shortened for the F4 window, when the file
    is loaded.

    The new code means that PUFF 2.3 can't read .PUF files older than V2.0
    Board parameters MUST be in the correct order, i.e. the same order as a
    saved .PUF file and all 17 must be present. Also in the F4 window,
    there must be a space between numbers and following unit.

39  If PUFF 2.3 tries to load a faulty .PUF file at start-up, then SETUP.PUF
    will be loaded, if possible. PUFF 2.3 will search all directories in the
    DOS path plus \PUFF for SETUP. If PUFF 2.3 can't find SETUP.PUF at start
    up then a SETUP.PUF file will be made in the current directory. The file
    will be sufficient for PUFF to start. PUFF 2.3 will quit after making
    the file; PUFF can only be started with a .PUF circuit file.

40  Improved the error reporting for lumped and transmission line parts in
    the F3 window. If pF is entered as Fp the error is detected, whereas
    before the value was read as Farads. In most cases the cursor will now
    move to the error position or near by. A small compromise was necessary
    for this to work: if a transmission line length is entered in metres then
    length corrections must be in terms of board height "H", not mm. There is
    no problem for line lengths in degrees or mm. Millimetres can no longer
    be entered as m m, or pF as p F

41  Added a 24 hour clock to the display.

42  Added the "Home" and "End" keys to the editing keys used to edit data
    in the F2, F3, and F4 windows.

43  Enabled editing keys and cursor in the message box when entering data.

44  Turned on stack overflow checking and added an overflow message to the
    exit procedure. Stack checking was disabled in PUFF 2.0 which can be
    a dangerous thing to do should PUFF crash with a stack overflow. This
    could result in damaged disc files.

45  Fixed a problem when the large parts list was set and F10 Help displayed.
    If "Help" was erased by toggling the list with the Tab key, the cursor
    couldn't be moved down past part "j".

46  Again with large parts set and in the F1 Layout window, if F10 Help was
    toggled then the highlight of the selected part disappeared...fixed. If
    F10 Help was displayed and a part "k" to "r" selected, the highlight
    overwrote "Help". Fixed by clearing "Help".

47  If a .PUF file containing a device part was loaded in, and the device
    file was missing, the error message was written four times...fixed.

48  Made the number of plot points proportional to free conventional memory
    between 80 and 200 kB instead of four coarse steps. Maximum plot points
    increases by one per 266 bytes of free memory.

49  Fixed a bug in component sweep. The fd prefix was written below the
    xy plot if fd was changed.

50  Added code to stop the F2 window cursor returning to the Points line
    after plotting a circuit.

51  PUFF crashed when plotting !tlines with extremely high losses.
    e.g. Plotting a 10 m long 50 ohm Microstrip line to 10 THz caused a
    crash at 6.4 THz. Fixed this too.

52  Except for SETUP.PUF, a comment line can now be read from or added to
    a .PUF circuit file. Press Ctrl+N for the message box. For maximum line
    length, the last letters are allowed to overwrite the lower border when
    entering a new comment. Press <Enter> to save the text line, or press Esc
    to abandon any change.
    N.B. The comment line must not start with a \ character.

53  The first comment line in a device file can be displayed in the message
    box by pressing Ctrl+D when the cursor is on a device part. If there is
    no comment line in the file, then the result is the same as pressing =
    Press any key to close the message box.

Re device files

  A device file has optional comment lines first, followed by a template
line, followed by S parameter data lines. In PUFF 2.0 comment lines start
with { # or ! characters. PUFF 2.3 comment lines start with any non-numeric
character except a backslash or comma and, before the template line, except
F f S s. There may be comment lines between and after the S parameter lines.
Numbers in the S parameter lines are separated by spaces. Device files must
be plain ASCII, not word processor files.
  S parameters have a magnitude component of linear voltage ratio, not dB,
and a phase component in degrees (-180 to +180).
  The PUFF manual says comment lines are optional but PUFF 2.0 crashed
my PC if there wasn't a first comment line. PUFF 2.3 doesn't crash and
should give an error message if the file is invalid in any way, including
negative magnitude numbers.
  PUFF can also read EEsof format files that don't have comment lines or
a template line. PUFF 2.3 reads a frequency unit from a  #  MHz  S MA  R 50
line in an EEsof file. You could add to such a line to EEsof files that lack
it.

  PUFF 2.0 didn't care if S parameters in a device file were for frequencies
in GHz, and Fd in the F4 window, was in MHz. All that PUFF checked was that
Fmin and Fmax for the plot were not outside of the frequency numbers in the
device file. PUFF 2.0 could tell you that the gain of a monolithic microwave
amplifier, over a range of 0.1 to 5 kHz or 0.1 to 5 MHz, is exactly the
same as for a frequency range of 0.1 to 5 GHz!
  Now in PUFF 2.3, if you add a device part to the F3 Parts list that has
the optional frequency unit in it, the prefix for the design frequency Fd,
will be changed after you leave the parts list, if it was different from
the existing prefix.
Furthermore, if Fd with the new prefix is outside of the frequency range
of the S parameters in the device file, Fd will be set to an approximate
mid point of the S parameter frequency span. (Adjust Fd as desired.)

  If you have added the device part to your circuit in the F1 Layout
window, set the plot frequency range so as to be within the device file
range; this has always been necessary with PUFF.
S parameter frequency range can now be found from the Parts window with
the = key, (see 36).

  I found many problems with the original PUFF code that read in data
from a device file. Of the eight error message routines, only two worked
properly.
  Another did detect a bad number format in some cases, if it wasn't a
frequency, but ignored non-numeric characters at the end of a number.
So if a phase angle of 100 degrees was entered as 1OO, PUFF read it as
1 degree with no error message. The error message was "Extra or missing
number" for all errors that were detected. If a number had a non-numeric
character within it, it was read in as two numbers. No error was reported
if there was both a bad number containing a non-numeric character, and a
missing number in the one data line.
  If a frequency number was bad or less than the previous frequency, then
file reading stopped without an error message. You would probably receive
an "Out of range" message when plotting, if PUFF didn't crash first.
  Four more of the error messages were not displayed because of a missing
line of code, and the routine to detect a missing template line didn't
work because PUFF crashed with this error. However if PUFF was recompiled
with Turbo Pascal 7.0, then the error was detected.
  All these problems have been fixed. For an extra/missing/invalid number
error, the error message tells you the faulty data line. Invalid numbers
have the position in the line reported. Commas can now be used as decimal
points. The "No S parameter" error message now works for all file types.
N.B. In PUFF 2.3, data lines may be no longer than 255 characters.

 R.G.Davison VK2ZRG  8th February 2008

  Formerly, PUFF was available from Caltech in the USA for US$10 along with
source code for US$10. It's now included with a book written by one of the
authors of PUFF.